{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>注册</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">公司名字</label>
                            <div class="layui-input-block">
                                <input type="text" name="c_name" class="layui-input" lay-verify="required" maxlength="100" placeholder="汉字、数字、字母及组合">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">公司logo：</label>
                            <input type="hidden" name="c_logo" id="lay-img" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传logo</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">负责人</label>
                            <div class="layui-input-block">
                                <input type="text" name="c_charge_name" class="layui-input" lay-verify="required" >
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">负责人电话</label>
                            <div class="layui-input-block">
                                <input type="text" name="c_charge_phone" maxlength="11" class="layui-input" lay-verify="required" >
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">企业后台账号</label>
                            <div class="layui-input-block">
                                <input type="text" name="c_username" class="layui-input" lay-verify="required" >
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">企业后台密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="c_password" class="layui-input" lay-verify="required" >
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md12">
                            <label class="layui-form-label">省市区：</label>
                            <div class="layui-input-inline">
                                <select name="c_sheng" lay-search="" id="province"  lay-filter="province"  lay-verify="required">
                                    <option value="">---- 请选择省 ----</option>
                                    {foreach name="province" item="v1"}
                                    <option value="{$v1.district_id}">{$v1.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="c_shi" lay-search=""  id="city"  lay-filter="city"  lay-verify="required">
                                    <option value="">---- 请选择市 ----</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="c_qu" lay-search=""  id="district"  lay-filter="district"  lay-verify="required">
                                    <option value="">---- 请选择区 ----</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">详细地址</label>
                            <div class="layui-input-block">
                                <input type="text" name="c_address" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">法人代表</label>
                            <div class="layui-input-block">
                                <input type="text" name="c_faren" class="layui-input" lay-verify="required" >
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">信用代码</label>
                            <div class="layui-input-block">
                                <input type="text" name="c_code" class="layui-input" lay-verify="required" placeholder="数字、字母及组合">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">营业执照：</label>
                            <input type="hidden" name="c_zhizhao" id="lay-img1" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload1">上传执照</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list1">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">公司介绍：</label>
                            <div class="layui-input-block" id="LAY_editor" lay-verify="editor">
                                <p></p>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">注册申请
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
</body>
</html>
<script>
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Register/upload')}",domain:""});
    wk.uploadImg({num:1,size:5,type:'png,jpg,jpeg',url:"{:url('Register/upload')}",domain:""});
    var editor = wk.wang({elem:'#LAY_editor',url:"{:url('Register/wangUpload')}"});
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            data.field.c_content = editor.txt.html();
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('register')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"/admin/login")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>